/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package supportlearning.session;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import supportlearning.entities.Account;

/**
 *
 * @author Huy
 */
@Stateless
public class deleteuser implements deleteuserLocal {
    @PersistenceContext(unitName = "eprojectSupportLearning-ejbPU")
    private EntityManager em;
    
      public boolean DeleteUser(int AccId) {
        try {
            Account acc = em.find(Account.class, AccId);
            if (acc == null) {
                return false;
            }
            em.remove(acc);

            return true;
        } catch (Exception e) {

            e.printStackTrace();
            return false;
        }

    }

    public void persist(Object object) {
        em.persist(object);
    }
 
}
